import request from '@/utils/request'

// 数据权限管理相关接口
export const dataauth = {
  // 获取数据权限列表
  getList: (params?: any) => {
    return request({
      url: '/api/home/dataauth/list',
      method: 'get',
      params,
    })
  },

  // 查看单个数据权限信息
  view: (id: number) => {
    return request({
      url: '/api/home/dataauth/view',
      method: 'get',
      params: { id },
    })
  },

  // 新建数据权限
  add: (data: any) => {
    return request({
      url: '/api/home/dataauth/add',
      method: 'post',
      data,
    })
  },

  // 编辑数据权限
  edit: (data: any) => {
    return request({
      url: '/api/home/dataauth/edit',
      method: 'put',
      data,
    })
  },

  // 删除数据权限
  delete: (id: number) => {
    return request({
      url: '/api/home/dataauth/del',
      method: 'delete',
      data: { id },
    })
  },
}

// 向后兼容方法
export const getDataauthList = dataauth.getList
export const viewDataauth = dataauth.view
export const addDataauth = dataauth.add
export const editDataauth = dataauth.edit
export const deleteDataauth = dataauth.delete
